<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@include file="/resource/common/taglib.jspf"%>
<%@include file="/resource/common/commonJs.jspf"%>
<%@include file="/resource/common/commonCss.jspf"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${SESSION_COMPANY}-用户列表</title>

<link rel="stylesheet" href="${ctx}/resource/css/msgTips.css" type="text/css" media="screen" />

<script type="text/javascript" src="${ctx }/resource/js/msgTips.js"></script>
<script type="text/javascript" src="${ctx }/resource/js/lib.js"></script>

<style type="text/css">
<!--
body {
	margin: 0px;
	font-family: "微软雅黑";
}

.content-box-content{
	padding:0;
}
-->
</style>
<script type="text/javascript">
	var PATH = "${ctx}";

	$(function() {

		//checkbox单选设置
		$(':checkbox[name=user]').each(function() {
			$(this).click(function() {
				if ($(this).attr('checked')) {
					$(':checkbox[name=user]').removeAttr('checked');
					$(this).attr('checked', 'checked');
				}
			});
		});
	});

	//查询
	function selectSearch() {
		var username = encodeURIComponent(encodeURIComponent($("#username")
				.val()));
		var contact = encodeURIComponent(encodeURIComponent($("#contact").val()));
		window.location.href = "selectUserList.do?username=" + username
				+ "&contact=" + contact;
	}
</script>
</head>

<body>
	<div id="body-wrapper">
		<div id="main-content">
			<div class="clear"></div>
				<div class="content-box-content">
					<div class="search-box">
						帐号：<input type="text" id="username" name="username" value="${username}" /> 
						联系人：<input type="text" id="contact" name="contact" value="${contact}" /> 
						<input type="button" onclick="selectSearch();" class="button" value="查询" />
						<input type="button" id="colse" name="colse" class="button" value="确定" />
					</div>
					<div class="tab-content default-tab" id="tab1">
						<table>
							<thead>
								<tr>
									<th>
									</th>
									<th align="center">序号</th>
									<th align="center">帐号</th>
									<th align="center">联系人</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach var="user" items="${pageBean.list}" varStatus="abc">
									<tr id="${user.uid}">
										<td><input type="checkbox" id="user_${user.uid}" name="user" value="${user.uid}#${user.username}" /></td>
										<td>${startRow+abc.count}</td>
										<td>${user.username}</td>
										<td>${user.contact}</td>
									</tr>
								</c:forEach>
							</tbody>

							<tfoot>
								<tr>
									<td colspan="4">
										<div class="pagination">
											<page:page url="selectUserList.do?username=${url_username }&" tagnum="2" pageBean="${pageBean}" />
										</div>
										<div class="clear"></div>
									</td>
								</tr>
							</tfoot>
						</table>
						
					</div>

				</div>
			</div>
		</div>


	<script>
		//获取当前窗口索引
		//关闭iframe
		$('#colse').click(function() {
			var index = parent.layer.getFrameIndex(window.name);

			var list = new Array();

			$('input[name="user"]:checked').each(function() {
				var val = $(this).val();
				list.push(val);
			});
			if (list.length > 0) {
				parent.setUser(list.join("|"));
			}
			parent.layer.close(index);
		});
	</script>
</body>
</html>
